Exercise 1

Install and load the rvest package. You can find more information about the package here.
# loading package
library(rvest)
## Loading required package: xml2

Exercise 2

Go to the Wikipedia entry for the most liked YouTube videos: https://en.wikipedia.org/wiki/List_of_most-liked_YouTube_videos and find the Xpath that corresponds to the whole table on the right side of the screen.
You can do this in Google Chrome by going to the website, right-clicking on the page and clicking on inspect. Alternatively, you can just press Ctrl + Alt + I. By expanding the containers and hovering your mouse over them, you can see which elements on the website they correspond to. To copy the Xpath of an element, right-click on the container and select copy -> Copy full Xpath. Be careful to select the HTML that encompasses the entire table and not only parts of it.
TablePath <- "/html/body/div[3]/div[3]/div[5]/div[1]/table[1]"

Exercise 3

Using the Xpath, extract the information from the table.
Use the read_html(), html_nodes() and html_table() functions. You can read more about them in the Help panel in RStudio or by calling them preceded by a question mark (e.g., ?read_html()).
# Setting URL
url <- "https://en.wikipedia.org/wiki/List_of_most-liked_YouTube_videos"

# Reading HTML from URL
html <- read_html(url)

# Navigating to the HTML node with the table object
Node <- html_nodes(html, xpath = TablePath)

# Extracting the table and assigning it to an R object
Table <- html_table(Node)

# Unlisting the dataframe
YouTubeData <- Table[[1]]